//
//  LGPatientReportController.m
//  BreathTrainingTool
//
//  Created by 1234 on 2024/7/18.
//

#import "LGPatientReportController.h"
#import "LGReportTableController.h"
@interface LGPatientReportController ()
/**   */
@property (nonatomic , strong)NSMutableArray *controllerArray;
/**   */
@property (nonatomic , strong)LGReportTableController *ctReportVC;
/**   */
@property (nonatomic , strong)LGReportTableController *inspectVC;
/**   */
@property (nonatomic , strong)LGReportTableController *examineVC;
/**   */
@property (nonatomic , strong)LGReportTableController *diseaseVC;
/**   */
@property (nonatomic , strong)LGReportTableController *medicineVC;
/**   */
@property (nonatomic , strong)NSArray *titleArray;

@end

@implementation LGPatientReportController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"患者报告";
    self.titleArray = @[@"CT影响检查",@"检验报告",@"检查报告",@"病历单",@"药物处方单"];
    [self addChildViewController:self.ctReportVC];
    [self addChildViewController:self.inspectVC];
    [self addChildViewController:self.examineVC];
    [self addChildViewController:self.diseaseVC];
    [self addChildViewController:self.medicineVC];
    [self.controllerArray addObject:self.ctReportVC];
    [self.controllerArray addObject:self.inspectVC];
    [self.controllerArray addObject:self.examineVC];
    [self.controllerArray addObject:self.diseaseVC];
    [self.controllerArray addObject:self.medicineVC];
    self.scrollView.backgroundColor = [UIColor clearColor];
    self.titleColorNormal = [UIColor colorWithString:@"#606266"];
    self.titleColorSelected = [UIColor colorWithString:kThemeColor];
    self.progressColor = [UIColor colorWithString:kThemeColor];
    self.menuView.backgroundColor = [UIColor clearColor];
    self.menuViewStyle=WMMenuViewStyleLine;
    self.titleFontName = @"STHeitiTC-Medium";
    self.titleSizeSelected = 16;
    self.titleSizeNormal = 14;
    self.progressWidth = viewPix(13);
    self.progressHeight = 3;
    self.progressViewBottomSpace = 0;
    self.progressViewCornerRadius = 2;
    self.selectIndex = 0;
    [self reloadData];
    self.scrollView.backgroundColor = [UIColor clearColor];
}

#pragma mark
#pragma mark ====> WMPageControllerDelegate
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return self.titleArray.count;
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    return self.titleArray[index];
}

- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    return self.controllerArray[index];
}

- (CGFloat)menuView:(WMMenuView *)menu widthForItemAtIndex:(NSInteger)index {
    return Screen_W/3.0;
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView {
    return CGRectMake(0, 0, Screen_W, viewPix(44));
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView {
    return CGRectMake(0, viewPix(44), Screen_W, Screen_H-topBarHeight-viewPix(44));
}

- (void)pageController:(WMPageController *)pageController willEnterViewController:(__kindof UIViewController *)viewController withInfo:(NSDictionary *)info{
    NSInteger index = [info[@"index"] integerValue];
    
//    LGBaseViewController *controller = (LGBaseViewController *)viewController;
//    [controller requestData];
//    NSLog(@">>>>>willEnterView>>>%@",viewController.title);
}

- (void)pageController:(WMPageController *)pageController didEnterViewController:(__kindof UIViewController *)viewController withInfo:(NSDictionary *)info{
    NSLog(@">>>>>didEnterView>>>%@",viewController.title);
}


-(NSMutableArray *)controllerArray{
    if(!_controllerArray){
        _controllerArray = [NSMutableArray array];
    }
    return _controllerArray;
}

-(LGReportTableController *)ctReportVC{
    if(!_ctReportVC){
        _ctReportVC = [[LGReportTableController alloc]init];
        _ctReportVC.patientid = self.patientid;
        _ctReportVC.type = @"1";
    }
    return _ctReportVC;
}

-(LGReportTableController *)inspectVC{
    if(!_inspectVC){
        _inspectVC = [[LGReportTableController alloc]init];
        _inspectVC.patientid = self.patientid;
        _inspectVC.type = @"2";
    }
    return _inspectVC;
}

-(LGReportTableController *)examineVC{
    if(!_examineVC){
        _examineVC = [[LGReportTableController alloc]init];
        _examineVC.patientid = self.patientid;
        _examineVC.type = @"3";
    }
    return _examineVC;
}

-(LGReportTableController *)diseaseVC{
    if(!_diseaseVC){
        _diseaseVC = [[LGReportTableController alloc]init];
        _diseaseVC.patientid = self.patientid;
        _diseaseVC.type = @"4";
    }
    return _diseaseVC;
}

-(LGReportTableController *)medicineVC{
    if(!_medicineVC){
        _medicineVC = [[LGReportTableController alloc]init];
        _medicineVC.patientid = self.patientid;
        _medicineVC.type = @"5";
    }
    return _medicineVC;
}

@end
